home *** CD-ROM | disk | FTP | other *** search
/ How Would You Survive? / How Would You Survive (1995)(Grolier)[Mac-PC].iso / mac / SHARED.DIR / 01988_Script_ChipClass < prev    next >
Text File  |  1995-09-13  |  4KB  |  148 lines

  1. global oGame, oGameControl
  2.  
  3. property iChipstate, iCastList, iChipNum -- unavailable, TOC or unturned
  4. property iSpriteNum, iCursor, iCurrentBase, iMySound, iBeenClicked, iWrongAnswer
  5.  
  6. --CHIPSTATES: 1=Inactive, 2=Unturned, 3=IN TOC
  7.  
  8. on birth me, pSpriteNum, pChipNum, pTOCLet
  9.   -- castlist
  10.   set vBaseChip=the number of cast "tile icon"
  11.   
  12.   set iCastList=[#inactive:vBaseChip+3, #Unturned:vBaseChip, #TOC:(the number of cast ("TOC."&pTOCLet))]
  13.   
  14.   set iChipNum=pChipNum
  15.   set iSpriteNum=pSpriteNum
  16.   set iChipState=2
  17.   set icursor="HANDCURSOR"
  18.   set iMyRollSound=""
  19.   set iBeenClicked=0
  20.   set iWrongAnswer=0
  21.   puppetsprite iSpriteNum, true
  22.   return me
  23. end birth
  24.  
  25. on mRedefineChipCast me, pTocLet
  26.   set vBaseChip=the number of cast "tile icon"
  27.   --put the number of cast ("TOC."&pTocLet)
  28.   set iCastList=[#inactive:vBaseChip+3, #Unturned:vBaseChip, #TOC:(the number of cast ("TOC."&pTocLet))]
  29. end mRedefineChipCast
  30.  
  31. on mSetWrongAnswer me, pAnswer
  32.   set iWrongAnswer=pAnswer
  33. end mSetWrongAnswer
  34.  
  35. on mGetWrongAnswer me
  36.   return iWrongAnswer
  37. end mGetWrongAnswer
  38.  
  39.  
  40. on mResetChip me
  41.   set iChipState=2
  42.   set the castnum of sprite iSpriteNum=getat(iCastList,iChipState)
  43.   updatestage
  44. end mResetChip
  45.  
  46. on mKillChip me
  47.   set iChipState=1
  48.   set the castnum of sprite iSpriteNum=getat(iCastList,iChipState)
  49.   updatestage
  50.   if the puppet of sprite iSpriteNum then puppetsprite iSpriteNum, 0
  51. end mKillChip
  52.  
  53. on mUnPuppetChip me
  54.   if the puppet of sprite iSpriteNum then puppetsprite iSpriteNum, 0
  55. end mUnPuppetChip
  56.  
  57.  
  58. on mChipClicked me
  59.   if iChipState=2 then
  60.     mShowQuestion(oGame, iChipNum)
  61.   else
  62.     if iChipState=3 then
  63.       if mGetLevel(oGame)=4 then
  64.         set iChipState=1 
  65.         -- in other words chip goes to inactive state on return and
  66.         -- game does not return w/ question open as it would in levels 1-3
  67.       else
  68.         mSetSuspended(oGame, iChipNum)
  69.       end if
  70.       if not(the shiftdown) then --APN 7/19
  71.         mLeaveToToc(oGameControl, the name of cast(the castnum of sprite iSpriteNum))
  72.       else
  73.         go frame "Entry"
  74.       end if
  75.     end if
  76.   end if
  77. end mChipClicked
  78.  
  79. on mUpdateChip me, pIncrement
  80.   if pIncrement then
  81.     if iChipState>1 then
  82.       set iChipState=iChipState+1
  83.       if iChipState=4 then set iChipState=1 --(mGetLevel(oGame)=4) or
  84.     end if
  85.   end if
  86.   if not(the puppet of sprite iSpriteNum) then puppetsprite iSpriteNum, true
  87.   set the castnum of sprite iSpriteNum=getat(iCastList, iChipState)
  88.   updatestage
  89. end mUpdateChip
  90.  
  91.  
  92. on hilight me
  93.   set pbeenClicked to False
  94.   if iChipState<>1 then
  95.     if mFullLivesOpen(oGame) or iChipState=3 then
  96.       repeat while (rollover(iSpriteNum))
  97.         do iCursor
  98.         puppettransition 0
  99.         
  100.         --    set the trace = true
  101.         --    if pRolloverFunction = "" then
  102.         --      nothing
  103.         --    else
  104.         --      do pRolloverFunction
  105.         --    end if
  106.         --    set the trace = false
  107.         
  108.         if (the castNum of sprite iSpriteNum = getat(iCastList, iChipState)) then
  109.           set the castNum of sprite iSpriteNum = (getat(iCastList, iChipState))+1 
  110.           if (iMySound) then puppetSound iMySound
  111.           set pbeenClicked to False
  112.           Updatestage
  113.         else
  114.           if (the mouseDown) then
  115.             set the castNum of sprite iSpritenum = (getat(iCastList, iChipState))+2 
  116.             set pbeenClicked to TRUE
  117.             Updatestage
  118.           else 
  119.             -- the mouse is up
  120.             if (pbeenClicked = true and rollover(iSpriteNum)) then
  121.               mresethilight me
  122.               Updatestage
  123.               mChipClicked me
  124.               return TRUE
  125.               abort
  126.             end if
  127.           end if
  128.         end if
  129.       end repeat
  130.       mresethilight me
  131.     end if
  132.   end if
  133.   return FALSE
  134. end
  135.  
  136. on mresethilight me
  137.   set the castNum of sprite iSpriteNum = (getat(iCastList, iChipState))
  138.   updatestage
  139. end mresethilight
  140.  
  141. on mGetChipState me
  142.   return iChipState
  143. end mGetChipState
  144.  
  145. on mSetChipState me, pState
  146.   set iChipState=pState
  147. end mSetChipState
  148.